﻿<div class="lrtmcontainer" ng-hide="lrtm.getTaskInstances() == 0">
    <div class="{{lrtm.ltrmShow == true ? 'lrtm-btn-container on': 'lrtm-btn-container off'}}">
        <div class="lrtm-btn-inner">
            <div class="lrtm-notifications">
                <div class="lrmt-notifications-finished" ng-show="lrtm.completedCount() !== 0">{{lrtm.completedCount()}} - Finished</div>
                <div class="lrtm-notification-progress" ng-show="lrtm.inProgressCount() !== 0">{{lrtm.inProgressCount()}} - In Progress</div>
            </div>
            <div><button type="button" ng-click="lrtm.ltrmShow = !lrtm.ltrmShow;" class="lrtm-btn-show"></button></div>
            <div class="clear">&nbsp;</div>
        </div>

    </div>
    <div class="lrtm" ng-show="lrtm.ltrmShow">
        <div class="lrtm-container">
            <!--<div class="lrtm-summary">
                <b>{{ lrtm.downloadGeneratingCount() }}</b> reports generating, <b>{{ lrtm.downloadGeneratedCount() }}</b> reports ready for download, <b>{{ lrtm.downloadGenerateFailedCount() }}</b> reports could not be generated, <b>{{ lrtm.uploadingCount() }}</b> uploads in progress
            </div>

            <div class="clearfix"></div>-->

            <div class="lrtm-task" ng-repeat="taskInstance in lrtm.getTaskInstances()" ng-class="{'last':$last}">
                <div class="lrtm_table-cell">
                    <div class="lrtm-task-progress">
                        <span ng-if="taskInstance.isDownloadGenerating() || taskInstance.isUploading()" ng-hide="taskInstance.status.taskStatus.progress == 100">
                            <img src="../Content/images/lrtm-ajax-loader.gif" width="24" />
                            <!--<span style="position: absolute; top: 1px; left: 1px;">{{ taskInstance.status.taskStatus.progress | number: 0 }}%</span>-->
                        </span>
                        <span ng-if="taskInstance.isDownloadGenerated() || taskInstance.isUploadComplete()">
                            <img src="../Content/images/icn-green-check-large.png" />
                        </span>
                        <span ng-if="taskInstance.isDownloadGenerationFailed() || taskInstance.isUploadFailed()">
                            <img src="../Content/images/icn-not-available.png" width="24" />
                        </span>
                        <!--<span ng-if="taskInstance.status.taskStatus.progress != 0 && !taskInstance.status.taskStatus.progress">
                            <img src="../Content/images/icn-not-available.png" width="16" />
                        </span>-->
                    </div>
                    <div class="lrtm_status_title">
                        <span ng-if="taskInstance.isDownloadGenerating()" class="lrtm_orange">Generating</span>
                        <span ng-if="taskInstance.isDownloadGenerated() || taskInstance.isFinished()" class="lrtm_green">Completed</span>
                        <span ng-if="taskInstance.isDownloadGenerationFailed()" class="lrtm_red"> Generation Failed</span>

                        <span ng-if="taskInstance.isUploading()" class="lrtm_orange">In Progress</span>
                        <span ng-if="taskInstance.isUploadComplete()" class="lrtm_green">Completed</span>
                        <span ng-if="taskInstance.isUploadFailed()" class="lrtm_red">Failed</span>
                    </div>
                    <div class="clear">&nbsp;</div>
                </div>
                <div class="" style="height: 60px;">
                    <div class="lrtm-task-title">
                        <span style="word-break: break-all;">{{ taskInstance.status.title }}</span> <br/>
                        <span style="color: white;" ng-repeat="err in taskInstance.errors">{{ err }}</span>
                    </div>
                </div>
                <div class="clear"></div>
                <div class="lrtm-task-actions">
                    <a ng-if="taskInstance.canCancel()" ng-class="taskInstance.canCancel() ? '' : 'inactive'" ng-click="$parent.lrtm.cancelTask(taskInstance);">Cancel</a>
                    <a ng-if="taskInstance.canDownload()" ng-class="taskInstance.canDownload() ? '' : 'inactive'" ng-click="$parent.lrtm.downloadTask(taskInstance);">Download</a>
                    <a ng-if="taskInstance.canClose()" ng-class="taskInstance.canClose() ? '' : 'inactive'" ng-click="$parent.lrtm.closeTask(taskInstance);">OK</a>
                    <div class="clear"></div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>